<?php
App::uses('AppModel', 'Model');
/**
 * BlocQuestion Model
 *
 * @property vox_bloc $vox_bloc
 * @property question $question
 */
class BlocQuestion extends AppModel {
	
	
	public function desactiverToutLesBlocs() {
		$this->query("UPDATE bloc_questions SET active=0");
	}
	// 
	
/**
 * Primary key field
 *
 * @var string
 */
	public $primaryKey = 'id_bloc';
/**
 * Display field
 *
 * @var string
 */
	public $displayField = 'description_bloc';
/**
 * Validation rules
 *
 * @var array
 */
	public $validate = array(
		'id_bloc' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'id_vox_bloc' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'rang_bloc_questions' => array(
			'numeric' => array(
				'rule' => array('numeric'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
			'notempty' => array(
				'rule' => array('notempty'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
	);

	//The Associations below have been created with all possible keys, those that are not needed can be removed

/**
 * hasOne associations
 *
 * @var array
 */
	public $hasOne = array(
		'vox_bloc' => array(
			'className' => 'vox_bloc',
			'foreignKey' => 'id_vox_bloc',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);

/**
 * hasMany associations
 *
 * @var array
 */
	public $hasMany = array(
		'question' => array(
			'className' => 'question',
			'foreignKey' => 'id_bloc',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);

}
